using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Raster._OrthoMapping
{
    /// <summary>
    /// <para>Compute Block Adjustment</para>
    /// <para>Computes the adjustments
    /// to the mosaic dataset. This tool will create a solution  table that can be used to apply the actual adjustments.</para>
    /// <para>计算调整
    /// 添加到镶嵌数据集。此工具将创建一个解决方案表，可用于应用实际调整。</para>
    /// </summary>    
    [DisplayName("Compute Block Adjustment")]
    public class ComputeBlockAdjustment : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ComputeBlockAdjustment()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_mosaic_dataset">
        /// <para>Input Mosaic Dataset</para>
        /// <para>The input mosaic dataset that will be adjusted.</para>
        /// <para>将调整的输入镶嵌数据集。</para>
        /// </param>
        /// <param name="_in_control_points">
        /// <para>Input Control Points</para>
        /// <para><xdoc>
        ///   <para>The control point table that includes tie points and ground control points.</para>
        ///   <para>This is usually the output from the Compute Tie Points tool.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>控制点表，包括连接点和地面控制点。</para>
        ///   <para>这通常是计算连接点工具的输出。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_transformation_type">
        /// <para>Transformation Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of transformation that will be used when adjusting the mosaic dataset.</para>
        ///   <bulletList>
        ///     <bullet_item>Zero-order polynomial—A zero-order polynomial is used in the block adjustment computation. This is commonly used when your data is in flat area.</bullet_item><para/>
        ///     <bullet_item>First-order polynomial—A first-order polynomial (affine) is used in the block adjustment computation. This is the default.</bullet_item><para/>
        ///     <bullet_item>Rational Polynomial Coefficients—The Rational Polynomial Coefficients will be used for the transformation. This is used for satellite imagery that contains RPC information within the metadata. This option requires the ArcGIS Desktop Advanced license.</bullet_item><para/>
        ///     <bullet_item>Frame camera model—The Frame camera model will be used for the transformation. This is used for aerial imagery that contains the frame camera information within the metadata. This option requires the ArcGIS Desktop Advanced license.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定调整镶嵌数据集时将使用的变换类型。</para>
        ///   <bulletList>
        ///     <bullet_item>零阶多项式—在块平差计算中使用零阶多项式。当您的数据位于平坦区域时，通常使用此方法。</bullet_item><para/>
        ///     <bullet_item>一阶多项式—在块平差计算中使用一阶多项式（仿射）。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>有理多项式系数—有理多项式系数将用于变换。这用于元数据中包含 RPC 信息的卫星影像。此选项需要 ArcGIS Desktop Advanced 许可。</bullet_item><para/>
        ///     <bullet_item>帧相机模型—帧相机模型将用于变换。这用于元数据中包含帧相机信息的航空影像。此选项需要 ArcGIS Desktop Advanced 许可。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_solution_table">
        /// <para>Output Solution Table</para>
        /// <para>The output solution table containing the adjustments.</para>
        /// <para>包含调整的输出解决方案表。</para>
        /// </param>
        public ComputeBlockAdjustment(object _in_mosaic_dataset, object _in_control_points, _transformation_type_value _transformation_type, object _out_solution_table)
        {
            this._in_mosaic_dataset = _in_mosaic_dataset;
            this._in_control_points = _in_control_points;
            this._transformation_type = _transformation_type;
            this._out_solution_table = _out_solution_table;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Compute Block Adjustment";

        public override string CallName => "management.ComputeBlockAdjustment";

        public override List<string> AcceptEnvironments => ["scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_mosaic_dataset, _in_control_points, _transformation_type.GetGPValue(), _out_solution_table, _out_solution_point_table, _maximum_residual_value, _adjustment_options, _location_accuracy.GetGPValue(), _out_quality_table];

        /// <summary>
        /// <para>Input Mosaic Dataset</para>
        /// <para>The input mosaic dataset that will be adjusted.</para>
        /// <para>将调整的输入镶嵌数据集。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Mosaic Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_mosaic_dataset { get; set; }


        /// <summary>
        /// <para>Input Control Points</para>
        /// <para><xdoc>
        ///   <para>The control point table that includes tie points and ground control points.</para>
        ///   <para>This is usually the output from the Compute Tie Points tool.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>控制点表，包括连接点和地面控制点。</para>
        ///   <para>这通常是计算连接点工具的输出。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Control Points")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_control_points { get; set; }


        /// <summary>
        /// <para>Transformation Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of transformation that will be used when adjusting the mosaic dataset.</para>
        ///   <bulletList>
        ///     <bullet_item>Zero-order polynomial—A zero-order polynomial is used in the block adjustment computation. This is commonly used when your data is in flat area.</bullet_item><para/>
        ///     <bullet_item>First-order polynomial—A first-order polynomial (affine) is used in the block adjustment computation. This is the default.</bullet_item><para/>
        ///     <bullet_item>Rational Polynomial Coefficients—The Rational Polynomial Coefficients will be used for the transformation. This is used for satellite imagery that contains RPC information within the metadata. This option requires the ArcGIS Desktop Advanced license.</bullet_item><para/>
        ///     <bullet_item>Frame camera model—The Frame camera model will be used for the transformation. This is used for aerial imagery that contains the frame camera information within the metadata. This option requires the ArcGIS Desktop Advanced license.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定调整镶嵌数据集时将使用的变换类型。</para>
        ///   <bulletList>
        ///     <bullet_item>零阶多项式—在块平差计算中使用零阶多项式。当您的数据位于平坦区域时，通常使用此方法。</bullet_item><para/>
        ///     <bullet_item>一阶多项式—在块平差计算中使用一阶多项式（仿射）。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>有理多项式系数—有理多项式系数将用于变换。这用于元数据中包含 RPC 信息的卫星影像。此选项需要 ArcGIS Desktop Advanced 许可。</bullet_item><para/>
        ///     <bullet_item>帧相机模型—帧相机模型将用于变换。这用于元数据中包含帧相机信息的航空影像。此选项需要 ArcGIS Desktop Advanced 许可。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Transformation Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _transformation_type_value _transformation_type { get; set; }

        public enum _transformation_type_value
        {
            /// <summary>
            /// <para>First-order polynomial</para>
            /// <para>First-order polynomial—A first-order polynomial (affine) is used in the block adjustment computation. This is the default.</para>
            /// <para>一阶多项式—在块平差计算中使用一阶多项式（仿射）。这是默认设置。</para>
            /// </summary>
            [Description("First-order polynomial")]
            [GPEnumValue("POLYORDER1")]
            _POLYORDER1,

            /// <summary>
            /// <para>Zero-order polynomial</para>
            /// <para>Zero-order polynomial—A zero-order polynomial is used in the block adjustment computation. This is commonly used when your data is in flat area.</para>
            /// <para>零阶多项式—在块平差计算中使用零阶多项式。当您的数据位于平坦区域时，通常使用此方法。</para>
            /// </summary>
            [Description("Zero-order polynomial")]
            [GPEnumValue("POLYORDER0")]
            _POLYORDER0,

            /// <summary>
            /// <para>Rational Polynomial Coefficients</para>
            /// <para>Rational Polynomial Coefficients—The Rational Polynomial Coefficients will be used for the transformation. This is used for satellite imagery that contains RPC information within the metadata. This option requires the ArcGIS Desktop Advanced license.</para>
            /// <para>有理多项式系数—有理多项式系数将用于变换。这用于元数据中包含 RPC 信息的卫星影像。此选项需要 ArcGIS Desktop Advanced 许可。</para>
            /// </summary>
            [Description("Rational Polynomial Coefficients")]
            [GPEnumValue("RPC")]
            _RPC,

            /// <summary>
            /// <para>Frame camera model</para>
            /// <para>Frame camera model—The Frame camera model will be used for the transformation. This is used for aerial imagery that contains the frame camera information within the metadata. This option requires the ArcGIS Desktop Advanced license.</para>
            /// <para>帧相机模型—帧相机模型将用于变换。这用于元数据中包含帧相机信息的航空影像。此选项需要 ArcGIS Desktop Advanced 许可。</para>
            /// </summary>
            [Description("Frame camera model")]
            [GPEnumValue("Frame")]
            _Frame,

        }

        /// <summary>
        /// <para>Output Solution Table</para>
        /// <para>The output solution table containing the adjustments.</para>
        /// <para>包含调整的输出解决方案表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Solution Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_solution_table { get; set; }


        /// <summary>
        /// <para>Output Solution  Points</para>
        /// <para>The output solution points table. This will be saved as a polygon feature class. This output can be quite large.</para>
        /// <para>输出解决方案点表。这将另存为面要素类。此输出可能非常大。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Solution  Points")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_solution_point_table { get; set; } = null;


        /// <summary>
        /// <para>Maximum Residual</para>
        /// <para><xdoc>
        ///   <para>A threshold that is used in block adjustment computation, points with residuals exceeding the threshold will not be used. This parameter applies when the transformation type is Zero-order polynomial, First-order polynomial, or Frame camera model. If the transformation is Rational Polynomial Coefficients, the proper threshold for eliminating invalid points will be automatically determined.</para>
        ///   <para>When the transformation is Zero-order polynomial or First-order polynomial the units for this parameter will be in map units, and the default value will be 2.</para>
        ///   <para>When the transformation is Frame camera model the units for this parameter will be in pixels, and the default value will be 5.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于区块平差计算的阈值，残差超过阈值的点将不被使用。当变换类型为零阶多项式、一阶多项式或帧相机模型时，此参数适用。如果变换是有理多项式系数，则将自动确定消除无效点的正确阈值。</para>
        ///   <para>当变换为零阶多项式或一阶多项式时，此参数的单位将采用映射单位，默认值为 2。</para>
        ///   <para>当变换为帧相机模型时，此参数的单位将以像素为单位，默认值为 5。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Residual")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _maximum_residual_value { get; set; } = 5;


        /// <summary>
        /// <para>Adjustment Options</para>
        /// <para><xdoc>
        ///   <para>Additional options that can fine-tune the adjustment computation. To set, type the keyword and the corresponding value in the list box.</para>
        ///   <bulletList>
        ///     <bullet_item>Minimum residual value—The minimum residual value, which is the lower threshold value. When polynomial transformation is either Zero-order polynomial or First-order polynomial, the units will be in map units and the default minimum residual will be 0. The minimum residual value and the maximum residual parameter are used in detecting and removing points that generate large errors from the block adjustment computation.</bullet_item><para/>
        ///     <bullet_item>Maximum residual factor—The maximum residual factor is a factor used to generate maximum (upper threshold) residual. If the Maximum Residual parameter is not defined, it will use the MaxResidualFactor * RMS to calculate the upper threshold value.The minimum residual value and the maximum residual parameter are used in detecting and removing points that generate large errors from block adjustment computation.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>可微调调整调整计算的其他选项。若要进行设置，请在列表框中键入关键字和相应的值。</para>
        ///   <bulletList>
        ///     <bullet_item>最小残差值 - 最小残差值，即下限值。当多项式变换为零阶多项式或一阶多项式时，单位将采用映射单位，默认最小残差为 0。最小残差值和最大残差参数用于检测和删除在块平差计算中产生较大误差的点。</bullet_item><para/>
        ///     <bullet_item>最大残差因子 - 最大残差因子是用于生成最大（阈值上限）残差的因子。如果未定义 Maximum Residual 参数，它将使用 MaxResidualFactor * RMS 来计算阈值上限。最小残差值和最大残差参数用于检测和去除在块平差计算中产生较大误差的点。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Adjustment Options")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _adjustment_options { get; set; } = null;


        /// <summary>
        /// <para>Image Location Accuracy</para>
        /// <para><xdoc>
        ///   <para>Specifies the geometric accuracy level of the images.</para>
        ///   <para>This parameter is only valid if Rational Polynomial Coefficients is specified as the Transformation Type value.</para>
        ///   <bulletList>
        ///     <bullet_item>High accuracy—Accuracy is under 30 meters.</bullet_item><para/>
        ///     <bullet_item>Medium accuracy—Accuracy is between 31 meters and 100 meters. This is the default.</bullet_item><para/>
        ///     <bullet_item>Low accuracy—Accuracy is higher than 100 meters.</bullet_item><para/>
        ///     <bullet_item>Very High accuracy—Imagery was collected with a high-accuracy, differential GPS, such as RTK or PPK. This option will keep image locations fixed during block adjustment.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>If low accuracy is specified, the control points will first be improved by an initial triangulation; then they will be used in the block adjustment calculation. The medium and high accuracy options do not require additional estimation processing.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定图像的几何精度级别。</para>
        ///   <para>仅当 Rational Polynomial Coefficients 指定为 Transformation Type 值时，此参数才有效。</para>
        ///   <bulletList>
        ///     <bullet_item>高精度—精度低于 30 米。</bullet_item><para/>
        ///     <bullet_item>中等精度 - 精度介于 31 米和 100 米之间。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>低精度 - 精度高于 100 米。</bullet_item><para/>
        ///     <bullet_item>非常高的精度 - 使用高精度差分 GPS（例如 RTK 或 PPK）采集影像。此选项将在块调整期间保持图像位置固定。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>如果指定低精度，则将首先通过初始三角测量来改进控制点;然后它们将用于区块调整计算。中精度和高精度选项不需要额外的估计处理。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Image Location Accuracy")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _location_accuracy_value _location_accuracy { get; set; } = _location_accuracy_value._MEDIUM;

        public enum _location_accuracy_value
        {
            /// <summary>
            /// <para>Low accuracy</para>
            /// <para>Low accuracy—Accuracy is higher than 100 meters.</para>
            /// <para>低精度 - 精度高于 100 米。</para>
            /// </summary>
            [Description("Low accuracy")]
            [GPEnumValue("LOW")]
            _LOW,

            /// <summary>
            /// <para>Medium accuracy</para>
            /// <para>Medium accuracy—Accuracy is between 31 meters and 100 meters. This is the default.</para>
            /// <para>中等精度 - 精度介于 31 米和 100 米之间。这是默认设置。</para>
            /// </summary>
            [Description("Medium accuracy")]
            [GPEnumValue("MEDIUM")]
            _MEDIUM,

            /// <summary>
            /// <para>High accuracy</para>
            /// <para>High accuracy—Accuracy is under 30 meters.</para>
            /// <para>高精度—精度低于 30 米。</para>
            /// </summary>
            [Description("High accuracy")]
            [GPEnumValue("HIGH")]
            _HIGH,

            /// <summary>
            /// <para>Very High accuracy</para>
            /// <para>Very High accuracy—Imagery was collected with a high-accuracy, differential GPS, such as RTK or PPK. This option will keep image locations fixed during block adjustment.</para>
            /// <para>非常高的精度 - 使用高精度差分 GPS（例如 RTK 或 PPK）采集影像。此选项将在块调整期间保持图像位置固定。</para>
            /// </summary>
            [Description("Very High accuracy")]
            [GPEnumValue("VERY_HIGH")]
            _VERY_HIGH,

        }

        /// <summary>
        /// <para>Output Adjustment Quality Table</para>
        /// <para><xdoc>
        ///   <para>An output table used to store adjustment quality information.</para>
        ///   <para>This parameter is only valid if Rational Polynomial Coefficients is specified as the Transformation Type value.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于存储调整质量信息的输出表。</para>
        ///   <para>仅当 Rational Polynomial Coefficients 指定为 Transformation Type 值时，此参数才有效。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Adjustment Quality Table")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _out_quality_table { get; set; } = null;


        public ComputeBlockAdjustment SetEnv(object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}